<?php
/**
 * @author shutyuka@gmail.com
 * @modified 2011-02-20
 */
class PreengageExtra{
	
	static public $TABLE_NAME="preengage_extra";

	static public function Create($id, $extraPrice, $extraAmount) {
		$preengage = array();
		
		$preengage['id'] = $id;
		
		$preengage['extra_price'] = $extraPrice;
		
		
		$preengage['extra_amount'] = $extraAmount;
		
		
		$preengage['create_time'] = time();
		$preengage['id'] = DB::Insert(self::$TABLE_NAME, $preengage);
		
		
		
		return $preengage['id'];
	}
	
	static public function GetById($id) {
		if (!$id) return array();
		return DB::GetTableRow(self::$TABLE_NAME, array('id' => $id));
	}
	
	static public function DeleteById($id, $opId){
		
		
		$sql = "delete from ".self::$TABLE_NAME." where id=$id" ;
		//Logs::setLog("new sql is || $sql ||");
		return DB::GetQueryResult($sql, false);
	}
}
